<?php /* Smarty version 2.3.0, created on 2011-08-18 00:11:09
         compiled from Default/add_survey.tpl */ ?>

<script>
function getSid()
{
    //alert(document.newSurvey.copy_survey.value);
    //alert(document.getElementById('preview_').href);
	
	var sid = document.newSurvey.copy_survey.value;
	if(sid == "")
	{ //quiere decir cuando la lista cambia a la primera opcion(ninguna) el sid es: ""
	    href = "http://#";
	}
	else
	{
	    href = '<?php echo $this->_tpl_vars['conf']['html']; ?>
/preview.php?sid=' + sid + '&preview_survey=1';
	}
    document.getElementById('preview_').href = href;
}
</script>

<?php echo '
<script>
  function cambiar_nombre(){
    if(document.newSurvey.tipo_encuesta.value == "puntaje"){
	  document.newSurvey.copy_survey.value = "";
	  document.newSurvey.copy_survey.disabled = "disabled";
	  document.getElementById(\'preview_\').href = "http://#";
	  document.getElementById(\'bCrear\').name = document.newSurvey.tipo_encuesta.value;

	}
	else{
	  document.newSurvey.copy_survey.disabled = "";
	  document.getElementById(\'bCrear\').name = document.newSurvey.tipo_encuesta.value;
    } 
  }
  
</script>
'; ?>


<form name="newSurvey" method="GET" action="<?php echo $this->_tpl_vars['conf']['html']; ?>
/new_survey.php">
<input type="hidden" name="a_id" value="<?php echo $this->_tpl_vars['a_id']; ?>
" />
<table align="center" bgcolor="#F7F7F7" style="BORDER-RIGHT:#999 1px solid; border-bottom:#999 1px solid; border-left:#999 1px solid; 
        border-top:#999 1px solid;" width="953" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td height="19" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="20" height="19" valign="top" bgcolor="#333333" style="border-bottom:#999999 2px solid;"><!--DWLayoutEmptyCell-->&nbsp;</td>
        <td width="644" valign="middle" bgcolor="#333333" style="border-bottom:#999999 2px solid;" class="style2">Crear
          Nueva Encuesta </td>
        <td width="268" valign="middle" bgcolor="#333333" style="border-bottom:#999999 2px solid;" class="style2" align="right"><a href="<?php echo $this->_tpl_vars['conf']['html']; ?>
/index.php" class="blanco">[Pagina Principal]</a></td>
        <td width="19" valign="top" bgcolor="#333333" style="border-bottom:#999999 2px solid;"><!--DWLayoutEmptyCell-->&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td width="15" height="152" valign="top" ><!--DWLayoutEmptyCell-->&nbsp;</td>
    <td width="936" valign="top"><table  width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="104" height="11"></td>
        <td width="20"></td>
        <td width="103"></td>
        <td width="579"></td>
        <td width="39"></td>
        <td width="76"></td>
        <td width="15"></td>
      </tr>
      <tr>
        <td height="19"></td>
		<td colspan="5" valign="top">
		  <?php if (isset($this->_sections["error"])) unset($this->_sections["error"]);
$this->_sections["error"]['name'] = "error";
$this->_sections["error"]['loop'] = is_array("1") ? count("1") : max(0, (int)"1");
$this->_sections["error"]['show'] = (bool)$this->_tpl_vars['error'];
$this->_sections["error"]['max'] = $this->_sections["error"]['loop'];
$this->_sections["error"]['step'] = 1;
$this->_sections["error"]['start'] = $this->_sections["error"]['step'] > 0 ? 0 : $this->_sections["error"]['loop']-1;
if ($this->_sections["error"]['show']) {
    $this->_sections["error"]['total'] = $this->_sections["error"]['loop'];
    if ($this->_sections["error"]['total'] == 0)
        $this->_sections["error"]['show'] = false;
} else
    $this->_sections["error"]['total'] = 0;
if ($this->_sections["error"]['show']):

            for ($this->_sections["error"]['index'] = $this->_sections["error"]['start'], $this->_sections["error"]['iteration'] = 1;
                 $this->_sections["error"]['iteration'] <= $this->_sections["error"]['total'];
                 $this->_sections["error"]['index'] += $this->_sections["error"]['step'], $this->_sections["error"]['iteration']++):
$this->_sections["error"]['rownum'] = $this->_sections["error"]['iteration'];
$this->_sections["error"]['index_prev'] = $this->_sections["error"]['index'] - $this->_sections["error"]['step'];
$this->_sections["error"]['index_next'] = $this->_sections["error"]['index'] + $this->_sections["error"]['step'];
$this->_sections["error"]['first']      = ($this->_sections["error"]['iteration'] == 1);
$this->_sections["error"]['last']       = ($this->_sections["error"]['iteration'] == $this->_sections["error"]['total']);
?>
		    <span class="error">Error: <?php echo $this->_tpl_vars['error']; ?>
</span>
		  <?php endfor; endif; ?>		</td>
        <td></td>
      </tr>
      <?php if (isset($this->_sections["name_survey"])) unset($this->_sections["name_survey"]);
$this->_sections["name_survey"]['name'] = "name_survey";
$this->_sections["name_survey"]['loop'] = is_array("1") ? count("1") : max(0, (int)"1");
$this->_sections["name_survey"]['show'] = (bool)$this->_tpl_vars['show']['survey_name'];
$this->_sections["name_survey"]['max'] = $this->_sections["name_survey"]['loop'];
$this->_sections["name_survey"]['step'] = 1;
$this->_sections["name_survey"]['start'] = $this->_sections["name_survey"]['step'] > 0 ? 0 : $this->_sections["name_survey"]['loop']-1;
if ($this->_sections["name_survey"]['show']) {
    $this->_sections["name_survey"]['total'] = $this->_sections["name_survey"]['loop'];
    if ($this->_sections["name_survey"]['total'] == 0)
        $this->_sections["name_survey"]['show'] = false;
} else
    $this->_sections["name_survey"]['total'] = 0;
if ($this->_sections["name_survey"]['show']):

            for ($this->_sections["name_survey"]['index'] = $this->_sections["name_survey"]['start'], $this->_sections["name_survey"]['iteration'] = 1;
                 $this->_sections["name_survey"]['iteration'] <= $this->_sections["name_survey"]['total'];
                 $this->_sections["name_survey"]['index'] += $this->_sections["name_survey"]['step'], $this->_sections["name_survey"]['iteration']++):
$this->_sections["name_survey"]['rownum'] = $this->_sections["name_survey"]['iteration'];
$this->_sections["name_survey"]['index_prev'] = $this->_sections["name_survey"]['index'] - $this->_sections["name_survey"]['step'];
$this->_sections["name_survey"]['index_next'] = $this->_sections["name_survey"]['index'] + $this->_sections["name_survey"]['step'];
$this->_sections["name_survey"]['first']      = ($this->_sections["name_survey"]['iteration'] == 1);
$this->_sections["name_survey"]['last']       = ($this->_sections["name_survey"]['iteration'] == $this->_sections["name_survey"]['total']);
?>
	  <tr>
	    <td height="30" colspan="2" valign="middle">
		  Tipo de Encuesta	    </td>
		<td colspan="3" valign="middle"><select name="tipo_encuesta" onchange="cambiar_nombre();">
              <option value="creaBasica" selected="selected">Basica</option><!--title="crear encuesta de una sola pregunta, no copia encuesta"-->
              <option value="next">Avanzada</option><!--title="crear encuesta de varias preguntas, puede copiar encuestas de la lista"-->
              <option value="puntaje">Con Puntaje</option><!--title="Crea encuestas con puntaje donde el rusultado describe el perfil del encuestado "-->
                        </select></td>
		<td>&nbsp;</td>
		<td></td>
	  </tr>
      <tr>
        <td height="38" colspan="2" valign="middle">Nombre de Encuesta </td>
          <td colspan="3" valign="middle"><input type="text" name="survey_name" size="40" maxlength="255" value="<?php echo $this->_tpl_vars['survey_name']; ?>
"></td>
          <td>&nbsp;</td>
          <td></td>
      </tr>
      <tr>
        <td height="30" colspan="2" valign="middle">Copiar Encuesta </td>
          <td colspan="3" valign="middle"><select name="copy_survey" size="1" onchange="getSid();">
            
            
          <?php if (isset($this->_sections["cs"])) unset($this->_sections["cs"]);
$this->_sections["cs"]['name'] = "cs";
$this->_sections["cs"]['loop'] = is_array($this->_tpl_vars['public_surveys']['sid']) ? count($this->_tpl_vars['public_surveys']['sid']) : max(0, (int)$this->_tpl_vars['public_surveys']['sid']);
$this->_sections["cs"]['show'] = (bool)"1";
$this->_sections["cs"]['max'] = $this->_sections["cs"]['loop'];
$this->_sections["cs"]['step'] = 1;
$this->_sections["cs"]['start'] = $this->_sections["cs"]['step'] > 0 ? 0 : $this->_sections["cs"]['loop']-1;
if ($this->_sections["cs"]['show']) {
    $this->_sections["cs"]['total'] = $this->_sections["cs"]['loop'];
    if ($this->_sections["cs"]['total'] == 0)
        $this->_sections["cs"]['show'] = false;
} else
    $this->_sections["cs"]['total'] = 0;
if ($this->_sections["cs"]['show']):

            for ($this->_sections["cs"]['index'] = $this->_sections["cs"]['start'], $this->_sections["cs"]['iteration'] = 1;
                 $this->_sections["cs"]['iteration'] <= $this->_sections["cs"]['total'];
                 $this->_sections["cs"]['index'] += $this->_sections["cs"]['step'], $this->_sections["cs"]['iteration']++):
$this->_sections["cs"]['rownum'] = $this->_sections["cs"]['iteration'];
$this->_sections["cs"]['index_prev'] = $this->_sections["cs"]['index'] - $this->_sections["cs"]['step'];
$this->_sections["cs"]['index_next'] = $this->_sections["cs"]['index'] + $this->_sections["cs"]['step'];
$this->_sections["cs"]['first']      = ($this->_sections["cs"]['iteration'] == 1);
$this->_sections["cs"]['last']       = ($this->_sections["cs"]['iteration'] == $this->_sections["cs"]['total']);
?>
            <option value="<?php echo $this->_tpl_vars['public_surveys']['sid'][$this->_sections['cs']['index']]; ?>
"><?php echo $this->_tpl_vars['public_surveys']['name'][$this->_sections['cs']['index']]; ?>
</option>
          <?php endfor; endif; ?>
        
          
          </select> 
		  
           &nbsp; <a id="preview_" href="http://#"  target="_blank" class="negro" title="muestra la encuesta elegida de la lista" ><strong>[Previsualizar]</strong></a>  </td>
          <td>&nbsp;</td>
          <td></td>
      </tr>
	  <?php endfor; endif; ?>
      <tr>
        <td height="43"></td>
          <td ></td>
          <td valign="middle" ><input type="submit" id="bCrear" name="creaBasica" value="Crear Encuesta"></td>
          <td valign="middle" ></td>
          <td >&nbsp;</td>
          <td></td>
          <td></td>
      </tr>
      
      
      <tr>
        <td height="32"></td>
        <td ></td>
        <td ></td>
        <td ></td>
        <td ></td>
        <td ></td>
        <td ></td>
      </tr>
      
      


    </table></td>
  </tr>
  
  <tr>
    <td height="26" colspan="2" valign="top"><table style="border-top:#999 1px solid;"  width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
       <td height="26" align="center" valign="middle" bgcolor="#EBEBEB" style="border-top:#D7D7D7 2px solid; border-bottom:#D7D7D7 2px solid;"><strong> <a href="<?php echo $this->_tpl_vars['conf']['html']; ?>
/index.php" class="negro">[
           Pagina Principal]</a></strong></td>
      </tr>
    </table></td>
  </tr>
</table>
</form>